package com.weme.common.arouter

import com.osom.proto.message.Brocast.MatchMessage
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.io.Serializable

class LiveRoomBean(
    var rtcToken: String,
    var channelId: String,
    var userId: Long,
    var chatRoomId: String,
    var channelName:String,
    var isIncoming:Boolean,//是否是呼入
    var matchMessage: MatchMessage? = null // 允许为null
) : Serializable {
    // Implementing serialization methods
    private fun writeObject(out: ObjectOutputStream) {
        out.writeObject(rtcToken)
        out.writeObject(channelId)
        out.writeLong(userId)
        out.writeObject(chatRoomId)
        out.writeObject(channelName)
        out.writeBoolean(isIncoming)
        out.writeObject(matchMessage) // 写入可能为null的matchMessage
    }

    private fun readObject(`in`: ObjectInputStream) {
        rtcToken = `in`.readObject() as String
        channelId = `in`.readObject() as String
        userId = `in`.readLong()
        chatRoomId = `in`.readObject() as String
        channelName = `in`.readObject() as String
        isIncoming = `in`.readBoolean()
        matchMessage = `in`.readObject() as? MatchMessage // 读取可能为null的matchMessage
    }

    companion object {
        private const val serialVersionUID = 1L
    }
}
